package com.polaris.live.viewmodel

import com.polaris.live.common.mvvm.viewmodel.BaseViewModel
import com.polaris.live.common.network.requestLoading
import com.polaris.live.common.util.ToastGravity
import com.polaris.live.net.userService
import com.polaris.live.resp.back_resp.UserContributionRank

/**
 *
 * @author Created by 天晴 on 2024/5/28 20:55
 * @since 1.0.0
 **/
class ContributionLisViewModel : BaseViewModel() {
    fun getRankData(
        anchorId: Long,
        rankType: Int,
        last: Boolean,
        back: (data: UserContributionRank) -> Unit
    ) {
        requestLoading({
            userService.getRank(anchorId, rankType, last)
        }, {
            back.invoke(it)
        }, {
            ToastGravity.showGravity(it.errorMsg)
        })

    }
}